using Unity.Entities;

namespace Game.Core
{
    public partial struct MovalbeRefreshJob : IJobEntity
    {
        void Execute(ref Movable movable, ref PropertyData data)
        {
            if ((data.Refresh & PropertyRefresh.Base) == PropertyRefresh.Base ||
                (data.Refresh & PropertyRefresh.Movable) == PropertyRefresh.Movable)
            {
                PropertyUtil.RefreshMovable(ref movable, in data); 
            } 
            
            if ((data.Refresh & PropertyRefresh.Init) == PropertyRefresh.Init)
            {
                movable.Detail.CurEncumbered = 0;
            }
            
            data.Refresh = PropertyRefresh.None;
        }
    }
}